package com.jie.deletefile.TestView;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jie.deletefile.R;

public class TextActivity extends AppCompatActivity {

    private TextView t_tv;
    private LinearLayout activity_text;
    private TextView t_tv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text);
        initView();
        initshow1();
        initshow2();
    }

    private void initshow2() {
        String s = "13952137957";
        String s1 = s.substring(0, 3) + "****" + s.substring(7);
        t_tv1.setText(s1);

    }

    private void initshow1() {
        String s = "13952137957";
        String s1 = s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
        Log.e("TAG", "initshow: " + s);
        t_tv.setText(s1);
    }

    private void initView() {
        t_tv = (TextView) findViewById(R.id.t_tv);
        activity_text = (LinearLayout) findViewById(R.id.activity_text);
        t_tv1 = (TextView) findViewById(R.id.t_tv1);
    }
}
